<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/vectrics.tld" prefix="vectrics" %>

<%@ page import="org.vectrics.recruiter.job.*" %>
<%@ page import="java.util.*" %>
<%@ page import="org.vectrics.recruiter.RecruitServiceLocator" %>
<%@ page import="org.vectrics.recruiter.config.RecruitConfig" %>

<%
	String jobId = request.getParameter("jobId");
	String jobCandidateId = request.getParameter("jobCandidateId");
	String candidatePersonId = request.getParameter("userId");
	if (candidatePersonId == null) {
		candidatePersonId = request.getParameter("personId");
	}
	
	if ((jobCandidateId==null) || (jobCandidateId.length() <= 0)) {
		jobCandidateId = (String)request.getAttribute("jobCandidateId");				
	}

	JobCandidate jobCandidate = RecruitServiceLocator.getJobProvider().findJobCandidateById(new Long(jobCandidateId));
	String companyId = jobCandidate.getJob().getCompany().getId().toString();

	String jobCandidateStatusCode = jobCandidate.getCurrentStatus().getStatusType().getCode();
	Collection nextStatuses = RecruitServiceLocator.getJobProvider().findJobCandidateStatusTypesTo(jobCandidateStatusCode);
%>

<table width="95%">
	<tr>
		<td valign="top">
			<vectrics:jobCandidate jobId="<%=jobId %>" userId="<%=candidatePersonId%>"/>
		</td>
		<td valign="top">
			<table>
			
	<% if (nextStatuses.size() > 0) { %>			
				<tr>
					<td>
						<form id="edit_candidate" action="/hrs-intranet/admin/jobs/candidate/edit.do" method="POST">
							<input type="hidden" name="jobCandidateId" value="<%=jobCandidateId%>">
							<input type="hidden" name="personId" value="<%=candidatePersonId%>">
							<vectrics:formButton elementId="candidate.edit.btn" code="button.param" phraseCode="button.candidate.change.status" value="submit" name="submit"/>
						</form>
					</td>
				</tr>
	<% } %>
				
				<tr>
					<td>
						<form id="view_person" action="/hrs-intranet/admin/user/view.do" method="POST">
							<input type="hidden" name="userId" value="<%=candidatePersonId%>">
							<input type="hidden" name="personId" value="<%=candidatePersonId%>">
							<vectrics:formButton elementId="view.person.btn" code="button.param" phraseCode="button.candidate.view.person" value="submit" name="submit"/>
						</form>
					</td>
				</tr>

				<tr>
					<td>
						<form action="/hrs-intranet/admin/user/encounter/newPhoneCall.do" method="POST">
							<input type="hidden" name="personId" value="<%=candidatePersonId%>">
							<vectrics:formButton 
								code="button.param" 
								phraseCode="button.person.new.phone" 
								elementId="person.new.call.btn"
								value="submit" 
								name="submit"/>
						</form>
					</td>
				</tr>

				<tr>
					<td>
						<form id="new_interview_form" action="/hrs-intranet/admin/jobs/candidate/interview/edit.do" method="POST">
							<input type="hidden" name="jobId" value="<%=jobId%>">
							<input type="hidden" name="userId" value="<%=candidatePersonId%>">
							<input type="hidden" name="personId" value="<%=candidatePersonId%>">
							<input type="hidden" name="companyId" value="<%=companyId%>">
							<vectrics:formButton elementId="new.interview.btn" code="button.param" phraseCode="button.candidate.interview.add" value="submit" name="submit"/>
						</form>
					</td>
				</tr>
			
			
			
				<tr>
					<td>
						<form id="view_job_form" action="/hrs-intranet/admin/jobs/view.do" method="POST">
							<input type="hidden" name="jobId" value="<%=jobId%>">
							<vectrics:formButton elementId="job.view.btn" code="button.param" phraseCode="button.job.view" value="submit" name="submit"/>
						</form>
					</td>
				</tr>
				<tr>
					<td>
						<form id="view_candidate_form" action="/hrs-intranet/admin/jobs/candidate/index.do" method="POST">
							<input type="hidden" name="jobId" value="<%=jobId%>">
							<vectrics:formButton elementId="candidate.btn" code="button.param" phraseCode="button.job.candidates" value="submit" name="submit"/>
						</form>
					</td>
				</tr>
				<tr>
					<td>
						<form id="resumes_form" action="/hrs-intranet/admin/user/resume/list.do" method="POST">
							<input type="hidden" name="jobCandidateId" value="<%=jobCandidateId%>">
							<input type="hidden" name="userId" value="<%=candidatePersonId%>">
							<vectrics:formButton code="button.param" 
								phraseCode="button.job.candidate.resumes"
								elementId="resumes.btn" 
								value="submit" name="submit"/>
						</form>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
